<html>
<head>
<title>${SiteTitle}</title>
<link href="../Themes/Standard/Standard.css" rel="stylesheet" type="text/css" />
<script>
function _JsExp(){
	this.over=function(el){
		el.className="over";
	};
	this.out=function(el){
		el.className="out";
	};

	this.overCat=function(el){
		el.className="over";
	};
	this.outCat=function(el){
		el.className="out";
	};

	this.checkData=function(objf)
	{
		submit=1;
		if (trim_str(objf.tbUsername.value)=="")
		{
			submit=0;
			alert("You must enter username!");
			return;
		}

		if (trim_str(objf.tbPassword.value)=="")
		{
			submit=0;
			alert("You must enter Password!");
			return;
		}

		if (trim_str(objf.tbPassword.value)!=trim_str(objf.tbConfirmPassword.value))
		{
			submit=0;
			alert("Passwords do not match!");
			return;
		}

		if (submit==1)
		{
			objf.submit();
		}
	};

	function trim_str(temp1){
		while(temp1.indexOf("'")!=-1)temp1=temp1.replace("'","")
		while(temp1.charAt(0)==" ")temp1=temp1.replace(temp1.charAt(0),"")
		i=temp1.length-1;while(i>0 && temp1.charAt(i)==" ")i--;temp1=temp1.substring(0,i+1)
		return temp1
	};

	this.editImg=function(id)
	{
		 myRef = window.open('../ImageAdd.aspx?id=' + id ,'','left=200,top=200,width=500,height=260,toolbar=0,resizable=0,scrollbars=0');
	};

	this.uploadImg=function(id)
	{
		 myRef = window.open('../ImageAdd.aspx?prid=' + id ,'','left=200,top=200,width=500,height=260,toolbar=0,resizable=0,scrollbars=0');
	}


}
var JsExp=new _JsExp();


</script>
</head>
<body style="background-color:#ffe4e1">
#set ($cp = $RenderCtx.CurrentPage)
#set ($pl = $RenderCtx.PageList)
#set ($cProduct = $RenderCtx.CurrentProduct)
#set ($ex = "_0_0/default.aspx")
#set ($cCat = $RenderCtx.CurrentCategory)
#set($category=$RenderCtx.CategoryList)
#set($cPageID=$RenderCtx.CurrentPage.ID)
#set($cNode=$RenderCtx.CategoryNode.CategoryList)

#set ($count = 0)
#set ($line = 0)

#set ($count = 0)
#macro( bindPage $PageList )
	#if($itemList)
		#set ($tempList = $itemList)
	#end
	#set ($line = ${line}+1)

	#if ($line > 2)
	  #set ($line = 1)
	#end

	#if ($PageList.Count>0)
		<ul>
		#foreach($p in $PageList)
			#if ($count==0)
				#set($ID=0)
			#else
				#set($ID=$p.ID)
			#end
			#set ($count = ${count}+1)

			#if($p.Hidden == true)
				#if($p.ID==$cp.ID)
					<li><a href="../${ID}${ex}" class="over" > $p.Name  </a></li>
				#else
					<li><a href="../${ID}${ex}" class="out" onmouseover="JsExp.over(this)" onmouseout="JsExp.out(this)"> $p.Name  </a></li>
				#end
			#end

		    #if($p.IsActive)
				#set ($itemList = $p.SubPageList)
			#end

		#end
	    </ul>
	#end
		#if($itemList)
			#if($itemList!=$tempList)
				#bindPage($itemList)
			#end
		#end

#end

<div id="cms_menu_photo">
	<ul>
	#bindPage($pl)
	</ul>
</div>
<!--
<div id="menu_login" >
#if($User.ID>0)
		<a href="../../${PageID}_0_0/default.aspx?gallery=1" class="login">My Gallery</a> |
		<a href="../../${PageLoginID}_0_0/default.aspx?account=1" class="login">My Account</a> |
		<a href="../../${PageID}_0_0/default.aspx?logout=1" class="login">Logout</a>

#else
		<a href="../../${PageLoginID}_0_0/default.aspx?login=1" class="login">Login</a>
#end
</div>
-->
#set ($default= "0")

<div id="cms_contentmain_photo">

	##-------------------Gallery----------------------

	#if(${Gallery})
		#set ($default= "1")
		<div id="cms_left_photo"></div>
		<div id="cms_right_content">
			<div id="cms_login">
				<div class="header">
				 <br><b> &nbsp; My Gallery</b><br>
				</div>

				<div class="body"><br>
					<form name="fGallery" method="post" action="../GalleryAdd.aspx?pageID=${cPageID}" class="text">
						#if($category.Count>0)
							#set ($icat=0)
							<table>
							#foreach($c in $category)
								#if($c.Author==$User.ID)
									#if($icat==0)
										<tr><td><b>Name</b></td><td><b>Description</b></td><td><b>Created date</b></td> <td><b>Upload photo</b></td><td><b>Update</b> </td></tr>
										#set ($icat=1)
									#end
									<tr><td><a href="../${cPageID}_${c.ID}_0/Default.aspx?viewgallery=1" class="over">${c.Name} (${c.CategoryList.Count}) </a></td>
									<td>${c.Description}</td>
									<td>${c.CreatedDate}</td>
									<td><input type="button" value="Upload photo" name="btnUpload" onclick="JsExp.uploadImg('${c.ID}')"></td>
									<td><a href="../${cPageID}_${c.ID}_0/Default.aspx?edit=1"> <u>edit</u> </a> <a href="../GalleryAdd.aspx?categoryID=${c.ID}&pageID=${cPageID}"> <u>delete</u> </a> </td>
									</tr>

								#end
							#end
							</table>
						#end
						<br><br><b>Create a New Gallery</b><br>
						Name Gallery <br>
						<input type="text" name="tbName"><br><br>

						Description<br>
						<input type="text" name="tbDescription"><br><br>

						<input type="submit" value="Add gallery" name="btnCollection"><br>
					</form>

				</div>
			</div>

		</div>
	#end

	##-------------------left----------------------
	#if($default=="0")
	<div id="cms_left_photo">
	<ul id="cms_slidedoormenu">
			#foreach($c in $category)
				#if($c.ID==$cCat.ID)
					<li><a href="../${cPageID}_${c.ID}_0/Default.aspx" class="over">${c.Name}</a></li>
				#else
					<li><a href="../${cPageID}_${c.ID}_0/Default.aspx" class="out" onmouseover="JsExp.overCat(this)" onmouseout="JsExp.outCat(this)" >${c.Name}</a></li>
				#end

			#end

	</ul>
	</div>
	#end

	##-------------------right----------------------
	<div id="cms_right_content">
              <div id="cms_menu_login" >
                      #if($User.ID>0)
                      		<a href="../../${PageID}_0_0/default.aspx?gallery=1" class="login">My Gallery</a> |
                      		<a href="../../${PageLoginID}_0_0/default.aspx?account=1" class="login">My Account</a> |
                      		<a href="../../${PageID}_0_0/default.aspx?logout=1" class="login">Logout</a>

                      #else
                      		<a href="../../${PageLoginID}_0_0/default.aspx?login=1" class="login">Login</a>
                      #end
                   </div>
	#if($default== "0")
		#if($cCat.ID>0)
				#if($cNode.Count>0)
					<div id="cms_media">
					#foreach($cn in $cNode)
                        <div class="block_media">
					        <div class="images">
                                <div class="middle" align="center">
                                    <div class="inner">
                                        <a href="../${cPageID}_${cn.ID}_0/Default.aspx"><img src="../ImageView.aspx?photo=${cn.ID}.jpg&mdim=110" border="0" align="middle"/></a>
                                    </div>
                                 </div>
                             </div>
                             <div class="info">$cn.Name
							     #if($cn.Author==$User.ID && $Edit==1)
								    <br> <a href="#" onclick="JsExp.editImg('${cn.ID}')" > <u>edit</u> </a> <a href="../GalleryAdd.aspx?categoryID=${cn.ID}&pageID=${cPageID}"> <u>delete</u> </a>
    							#end
	    					 </div>
                        </div>

					#end
					</div>
				#else
					<div style="height:10px;"></div>
					<div id="cms_block_Images">
						<div class="images">
                            <a href="../${cPageID}_${CategoryParentID}_0/Default.aspx"><img src="../ImageView.aspx?photo=${cCat.ID}.jpg&mdim=600" border="0" /></a></div>
						    <div class="info">$cCat.Name<br> $cCat.Description</div>

					</div>
				#end


		#else
				<div id="cms_media">

                   	#foreach($c in $category)
					#set ($idImage = 0)
					#foreach($ic in $c.CategoryList)
						#set ($idImage = $ic.ID)
					#end
                    <div class="block_media">
					    <div class="images">
                            <div class="middle" align="center">
                                <div class="inner">
                                    <a href="../${cPageID}_${c.ID}_0/Default.aspx"><img valign="middle" src="../ImageView.aspx?photo=${idImage}.jpg&mdim=110" border="0" /></a>
                                </div>
                            </div>
                        </div>
                        <div class="info">
                            $c.Name ($c.CategoryList.Count)
                        </div>
					</div>

				#end
			   </div>
		#end
	</div>
	#end

</div>


</body>
